<?php
namespace Mob\Controller;
/**
 * 收款账号
 * @author Administrator
 *
 */
class BankAccountController extends MobBaseController
{
    public function index(){
        $con5['id'] = session('uid');
        $user = M('user')->field(true)->where($con5)->find();
        $bank = D('UserBank')->get(array('uid'=> session('uid')));
        $count = D('UserBank')->getCount(array('uid'=> session('uid')));
        $code=substr($bank["bankcode"], 0,3)."******".substr($bank["bankcode"], strlen($bank["bankcode"])-4, strlen($bank["bankcode"]));
        $this->assign('bank', $bank);
        $this->assign('user', $user);
        $this->assign('code', $code);
        $this->assign('count', $count);
        $this->display("bankAccount/index");
    }
    
    public function saveBankAccount(){
        $arry=array(
                'uid' => session('uid'),
                'bankname' => I("post.bankname",""),
                'fullname' => I("post.fullname",""),
                'username' => I("post.username",""),
                'bankcode' => I("post.bankcode",""),
            );
        $result = D('UserBank')->inst($arry);
        $resp['status']=1;
        $resp['msg']="新增成功！";
        $this->ajaxReturn($resp,'JSON');
    }
    
}